﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSemIII.Administrator.UserControl
{
    public partial class SecondMenu : System.Web.UI.UserControl
    {
        private string pageName;
        protected void Page_Load(object sender, EventArgs e)
        {
            pageName = Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath);
            this.innerSecondMenu();
            this.activeSecondMenu();
        }
        public void innerSecondMenu()
        {
            if (pageName.Contains("Account"))
            {
                link1.NavigateUrl = "/Administrator/Account/PendingAccount.aspx";
                text1.InnerText = "Pending Account";
                link2.NavigateUrl = "/Administrator/Account/ActivedAccount.aspx";
                text2.InnerText = "Actived Account";
                link3.NavigateUrl = "/Administrator/Account/YourAccount.aspx";
                text3.InnerText = "Your Account";
                text4.Visible = false;
                link4.Visible = false;
            }
            else if (pageName.Contains("Survey") || pageName.Contains("ViewResult"))
            {
                link1.NavigateUrl = "/Administrator/Survey/SurveyCatalog.aspx";
                text1.InnerText = "Create Survey Catalog";
                link2.NavigateUrl = "/Administrator/Survey/CreateSurvey.aspx";
                text2.InnerText = "Create New Survey";
                link3.NavigateUrl = "/Administrator/Survey/ManageSurvey.aspx";
                text3.InnerText = "Manage Survey";
                text4.Visible = false;
                link4.Visible = false;
            }
            else if (pageName.Contains("Support") || pageName.Contains("FAQ"))
            {
                link1.NavigateUrl = "/Administrator/Support/Support.aspx";
                text1.InnerText = "Manage Support";
                link2.NavigateUrl = "/Administrator/Support/FAQ.aspx";
                text2.InnerText = "Manage FAQ";
                link3.Visible = false;
                link4.Visible = false;
                text3.Visible = false;
                text4.Visible = false;
            }
        }
        public void activeSecondMenu()
        {
            if (pageName.Contains("Pending") || pageName.Contains("SurveyCatalog") || pageName.Contains("Support"))
            {
                link1.CssClass = "this";
            }
            else if (pageName.Contains("Actived") || pageName.Contains("CreateSurvey") || pageName.Contains("FAQ"))
            {
                link2.CssClass = "this";
            }
            else if (pageName.Contains("ManageSurvey") || pageName.Contains("Your"))
            {
                link3.CssClass = "this";
            }
        }
    }
}